#include<iostream>
using namespace std;
typedef long long ll;
string s1 = "1";//"COFFEE"
string s2 = "2";//"CHICKEN"
string ns1 = "COFFEE";
string ns2 = "CHICKEN";

string func(ll n)
{
    if (n == 1) return s1;
    if (n == 2) return s2;
    return func(n - 2) + func(n - 1);
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        ll n, k;
        cin >> n >> k;
        string str = func(n);
        ll cur = 0;
        for (int i = 0; i < str.size(); i++)
        {
            if (str[i] == '1') cur += 6;
            else cur += 7;
            if (cur >= k)
            {
                if (str[i] == '1')
                    for (int i = k - 1; i < ns1.size(); i++) cout << ns1[i];
                else
                    for (int i = k - 1; i < ns2.size(); i++) cout << ns2[i];
                for (int j = i + 1; j < str.size(); j++)
                    if (str[j] == '1') cout << ns1;
                    else cout << ns2;
                break;
            }
        }
        cout << endl;
    }
    return 0;
}